package innerclass;


public class MethodLocalInnerClass {

	static final int i = 2;
	static int k = 21;
	int x = 4;
	
	Thread runnable;
	
	void method() {
		class A implements Runnable{
//			private String instanceString = "instanceString";
//			private final String finalInstanceString = "finalInstanceString";
			
			@Override
			public void run() {
				int i = 0;
				while(i++ < 10) {
					try {
						System.out.println(i+ ": Going to sleep for 650 ms.");
						Thread.sleep(650);
					} catch (InterruptedException e) { }
				}
			}
		}
		
		runnable = new Thread(new A());
		runnable.start();
		System.out.println("end of method");
	}
	
	private void join() {
		try {
			if (runnable.isAlive()) {
				System.out.println("ALIVE");
			}
			System.out.println("joining");
			runnable.join();
			System.out.println("end of join");
		} catch (InterruptedException e) {	
			System.err.println("ERRROR");
		}
	}
	
	public static void main(String[] args) {
		MethodLocalInnerClass class1 = new MethodLocalInnerClass();
		class1.method();
		class1.join();
	}
	
}
